T
CSharpTest.Net
LListNode.LList<T> Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace : LListNode.LList<T> Class

Glossary Item Box

Provides a linked list of nodes of type T

Syntax

Visual Basic (Declaration) 
Public Class LListNode.LList(Of T) 
   Inherits CSharpTest.Net.Collections.LListNode.LList(Of LListNode(Of T))
C# 
public class LListNode.LList<T> : CSharpTest.Net.Collections.LListNode.LList<LListNode<T>> 

Type Parameters

T

Example

Library/Library.Test/TestLinkList.cs

C#Copy Code
LListNode<string> empty = new LListNode<string>();
LListNode<string> valueA = new LListNode<string>("A");
LListNode<string> valueB = new LListNode<string>("B");
LListNode<string>.LList list = new LListNode<string>.LList();

list.AddFirst(empty);
Assert.AreEqual(1, list.Count);
Assert.AreEqual(empty, list.First);
Assert.AreEqual(empty, list.Last);
Assert.IsNull(empty.Next);
Assert.IsNull(empty.Previous);

list.AddLast(valueB);
Assert.AreEqual(2, list.Count);
Assert.AreEqual(empty, list.First);
Assert.AreEqual(valueB, list.Last);

Assert.AreEqual(valueB, empty.Next);
Assert.IsNull(empty.Previous);

Assert.AreEqual(empty, valueB.Previous);
Assert.IsNull(valueB.Next);

list.AddFirst(valueA);
Assert.AreEqual(3, list.Count);
Assert.AreEqual(valueA, list.First);
Assert.AreEqual(valueB, list.Last);

Assert.AreEqual(valueB, empty.Next);
Assert.AreEqual(valueA, empty.Previous);

Assert.AreEqual(empty, valueA.Next);
Assert.IsNull(valueA.Previous);

Assert.AreEqual(empty, valueB.Previous);
Assert.IsNull(valueB.Next);

list.Remove(empty);
Assert.AreEqual(2, list.Count);
Assert.AreEqual(valueA, list.First);
Assert.AreEqual(valueB, list.Last);

Assert.AreEqual(valueB, valueA.Next);
Assert.IsNull(valueA.Previous);

Assert.AreEqual(valueA, valueB.Previous);
Assert.IsNull(valueB.Next);
VB.NETCopy Code
Dim empty As New LListNode(Of String)()
Dim valueA As New LListNode(Of String)("A")
Dim valueB As New LListNode(Of String)("B")
Dim list As New LListNode(Of String).LList()

list.AddFirst(empty)
Assert.AreEqual(1, list.Count)
Assert.AreEqual(empty, list.First)
Assert.AreEqual(empty, list.Last)
Assert.IsNull(empty.[Next])
Assert.IsNull(empty.Previous)

list.AddLast(valueB)
Assert.AreEqual(2, list.Count)
Assert.AreEqual(empty, list.First)
Assert.AreEqual(valueB, list.Last)

Assert.AreEqual(valueB, empty.[Next])
Assert.IsNull(empty.Previous)

Assert.AreEqual(empty, valueB.Previous)
Assert.IsNull(valueB.[Next])

list.AddFirst(valueA)
Assert.AreEqual(3, list.Count)
Assert.AreEqual(valueA, list.First)
Assert.AreEqual(valueB, list.Last)

Assert.AreEqual(valueB, empty.[Next])
Assert.AreEqual(valueA, empty.Previous)

Assert.AreEqual(empty, valueA.[Next])
Assert.IsNull(valueA.Previous)

Assert.AreEqual(empty, valueB.Previous)
Assert.IsNull(valueB.[Next])

list.Remove(empty)
Assert.AreEqual(2, list.Count)
Assert.AreEqual(valueA, list.First)
Assert.AreEqual(valueB, list.Last)

Assert.AreEqual(valueB, valueA.[Next])
Assert.IsNull(valueA.Previous)

Assert.AreEqual(valueA, valueB.Previous)
Assert.IsNull(valueB.[Next])

Inheritance Hierarchy

System.Object
   CSharpTest.Net.Collections.LListNode.LList<TNode>
      CSharpTest.Net.Collections.LListNode`1.LList<T>

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys